<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    
</head>
<body>
    <button><span>按钮</span></button>
    <script>
        var img = document.createElement('img');
        img.src = 'logo.png';
        img.width='40';
        // 将创建的元素添加到父元素
        var btn = document.querySelector('button');
        var span = btn.querySelector('span')
        // btn.appendChild(img);
        btn.insertBefore(img,span);
    </script>
</body>
</html>